<template>
	<view>
		<view class="nav ">
			 <u-tabs :list="list1" @click="click" :scrollable="false" 
			         :inactiveStyle="inactiveStyle" :activeStyle="activeStyle" :lineWidth="52"
					  :lineColor="color" :current="current"></u-tabs>
		</view>
		<view class="viewbox auto p-top100 ">
			
			<view class="lis bot d-flex" v-for="(item,index) in pageData" :key="index" 
			     @click="$toCourses(item.goods_id)">
				<image :src="$imgUrls(item.img)" mode="aspectFill" class="list_img"></image>
				<view class="flex-1 d-flex f-column j-sa">
					<view class="d-flex a-center">
						<!-- <view class="tip flexac biStudy">
							<text class="tip_txt">必学</text>
						</view> -->
						<text class="flex-1 size26 color_33 bold ellipsis">{{item.name}}</text>
					</view>
					<view class="rows ellipsis_2 color_99 size22">{{item.info}}</view>
					<view class="row j-sb a-center">
						<text class="color_E6 h7 time">{{item.learn_end_time}}时前完成</text>
						<view class="d-flex f-column">
							<text class="color_66 h7 schedule">总进度 {{item.percent}}%</text>
							<view class="progor m-top10">
								<view class="schPro" :style="{width:item.percent+'%'}"></view>
							</view>
						</view>
					</view>
				</view>
			</view>
		
		
		   <empty v-if="!pageData.length"></empty>	
		
			
			
			
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex';
	export default {
		data() {
			return {
				list1:[{
					name:'学习中'
				},{
					name:'已学完'
				},{
					name:'已过期'
				}],
				itemStyle:{
					height:'70rpx'
				},
				current:0,
				pageData:[],
			}
		},
		onLoad() {
			this.myRank();
		},
		methods: {
			myRank(){
				this.$http.post({
					url:'/DisciplineApi/myRank',
					data:{
						state:this.current,
						token: this.bid,
					}
				}).then(res=>{
					if(res.code != 200) return this.$Toast(res.msg);
					this.pageData = res.data || [];
				})
			},
			click(e){
				this.current = e.index;
				this.myRank();
			}
		},
		computed:{
			...mapState(['inactiveStyle','activeStyle','color','bid'])
		}
	}
</script>

<style lang="scss" scoped>
	// #ifdef MP-WEIXIN
	.nav{
		width:100%;
		height: 100rpx;
		padding:0 100rpx;
		position: fixed;
		top:0;
		left:0;
		z-index:100;
		background-color: #ffffff;
	}
	// #endif
	// #ifdef H5
	.nav{
		width:100%;
		height: 100rpx;
		padding:0 100rpx;
		position: fixed;
		top:40px;
		left:0;
		z-index:100;
		background-color: #ffffff;
	}
	// #endif
	.lis{
		width:100%;
		height: 200rpx;
		padding:30rpx 0;
		box-sizing: content-box;
	}
	.list_img{
		width:264rpx;
		height: 200rpx;
		margin-right: 20rpx;
	}
	.tip{
		border-radius: 8rpx;
		padding:2rpx 4rpx;
		margin-right: 10rpx;
	}
	.biStudy{
		background-color: #FFB346;
	}
	.xuanStudy{
		background-color: #43A0FF;
	}
	.tip_txt{
		color:#ffffff;
		font-size:20rpx;
		zoom:0.9;
	}
	.progor{
		width: 110rpx;
		height: 10rpx;
		background: #E4E4E4;
		border-radius: 6rpx;
		position: relative;
		overflow: hidden;
	}
	// .schedule,.time{
	// 	zoom:0.9;
	// }
	.schPro{
		height: 100%;
		background-color: #FF5255;
		position: absolute;
		top:0;
		left:0;
	}
</style>
